Learn R Programming

Directional (version 2.2)

Circular or angular regression: Circular or angular regression

Description

Regression with circualr dependent variable and Euclidean or categorical independent variables.

Usage

spml.reg(y, x, rads = TRUE, xnew = NULL, seb = TRUE)

Arguments

y
The dependent variable, it can be in radians or degrees.
x
The independent variable(s). Can be Euclidean or categorical (factor variables).
rads
If the dependent variable is expressed in rads, this should be TRUE and FALSE otherwise.
xnew
The new values of some independent variable(s) whose circular values you want to predict. Can be Euclidean or categorical. If they are categorical, the user must provide them as dummy variables. It does not accept factor variables. If you have no new x values, leave it NULL (default).
seb
a boolean variable. If TRUE, the standard error of the coefficients willbe be returned. Set to FALSE in case of simulation studies or in other cases such as a forward regression setting for example. In these cases, it can save some time.

Value

A list including: A list including:

Details

The E-M algorithm is fitted in this regression as described in Presnell et al. (1998).

References

Presnell Brett, Morrison Scott P. and Littell Ramon C. (1998). Projected multivariate linear models for directional data. Journal of the American Statistical Association, 93(443): 1068-1077.

See Also

circlin.cor, circ.cor1, circ.cor2, spher.cor, spher.reg

Examples

Run this code
x <- rnorm(100)
z <- cbind(3+ 2 * x, 1 -3 * x)
y <- cbind( rnorm(100,z[ ,1], 1), rnorm(100, z[ ,2], 1) )
y <- y / sqrt( rowSums(y^2) )
y <- ( atan( y[, 2] / y[, 1] ) + pi * I(y[, 1] < 0) ) %% (2 * pi)
spml.reg(y, x, rads = TRUE)

Run the code above in your browser using DataLab